package com.cd.javacxy.module.web.service;

import com.cd.javacxy.common.model.entity.CxyAttachment;
import com.cd.javacxy.common.model.entity.SessionUser;
import com.cd.javacxy.common.model.enums.FileTopicType;
import com.cd.javacxy.exception.BussinessException;

/**
 * CxyAttachment的服务接口
 *
 * @author yanghy
 */
public interface CxyAttachmentService {
    int addAttachment(CxyAttachment attachment) throws BussinessException;

    CxyAttachment getAttachmentByTopicIdAndFileType(Integer topicId, FileTopicType fileTopicType);

    CxyAttachment getAttachmentById(Integer attachmentId);

    CxyAttachment downloadAttachment(SessionUser sessionUser, Integer attachmentId) throws BussinessException;

    int checkDownloadPermission(Integer topicUserId, Integer userId, Integer downloadMark,
                                Integer attachmentId) throws BussinessException;

    int checkDownload(Integer attachmentId, Integer topicId, SessionUser sessionUser) throws BussinessException;

    int deleteFile(Integer attachmentId);
}
